import request from '@/config/axios'

// 标签关系 VO
export interface TagRelationVO {
  id: number // 主键
  entityId: number // 实体ID
  entityType: string // 实体类型
  tagId: number // 标签ID
  creatorName: string // 创建人
  updaterName: string // 更新人
  version: number // 版本号
}

// 标签关系 API
export const TagRelationApi = {
  // 查询标签关系分页
  getTagRelationPage: async (params: any) => {
    return await request.get({ url: `/common/tag-relation/page`, params })
  },

  // 查询标签关系详情
  getTagRelation: async (id: number) => {
    return await request.get({ url: `/common/tag-relation/get?id=` + id })
  },

  // 新增标签关系
  createTagRelation: async (data: TagRelationVO) => {
    return await request.post({ url: `/common/tag-relation/create`, data })
  },

  // 修改标签关系
  updateTagRelation: async (data: TagRelationVO) => {
    return await request.put({ url: `/common/tag-relation/update`, data })
  },

  // 删除标签关系
  deleteTagRelation: async (id: number) => {
    return await request.delete({ url: `/common/tag-relation/delete?id=` + id })
  },

  // 导出标签关系 Excel
  exportTagRelation: async (params) => {
    return await request.download({ url: `/common/tag-relation/export-excel`, params })
  },
}